package com.nabi.library.contents.elements.figure
{
	import com.nabi.library.contents.elements.NabiObject;
	import com.nabi.library.contents.elements.Outline;
	import com.nabi.library.contents.elements.segment.CloseSegment;
	import com.nabi.library.contents.elements.segment.LineSegment;
	import com.nabi.library.contents.elements.segment.MoveSegment;
	import com.nabi.library.contents.geom.ITransform;
	import com.nabi.library.contents.geom.NativeTransform;
	
	public class Rect extends NabiObject
	{
		public function Rect($x:Number = 0, $y:Number = 0, $width:Number = 1, $height:Number = 1)
		{
			var outline:Outline = new Outline();
			var outlineList:Vector.<Outline> = new Vector.<Outline>();
			
			outline.AddTail(new MoveSegment(Vector.<Number>([$x, $y])));
			outline.AddTail(new LineSegment(Vector.<Number>([($x + $width), $y])));
			outline.AddTail(new LineSegment(Vector.<Number>([($x + $width), ($y + $height)])));
			outline.AddTail(new LineSegment(Vector.<Number>([$x, ($y + $height)])));
			outline.AddTail(new CloseSegment(Vector.<Number>([$x, $y])));
			outline.Update();
			outlineList.push(outline);
			
			super(outlineList);
			
			var transform:ITransform = new NativeTransform(this);
			SetTransform(transform);
		}
	}
}